package com.medical.blood.controller;

import com.medical.blood.entity.BloodReservation;
import com.medical.blood.service.imp.BloodReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/bloodReservation")
public class BloodReservationController {
    @Autowired
    private BloodReservationService bloodReservationService;

    // 保存采血预约
    @PostMapping("/save")
    public boolean saveBloodReservation(@RequestBody BloodReservation bloodReservation) {
        return bloodReservationService.saveBloodReservation(bloodReservation);
    }

    // 根据用户ID查询预约列表
    @GetMapping("/listByUserId")
    public List<BloodReservation> listBloodReservationByUserId(Long userId) {
        return bloodReservationService.listBloodReservationByUserId(userId);
    }
}